<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:rich="http://richfaces.org/rich"
	  xmlns:a4j="http://richfaces.org/a4j">

	<body>
	
		<ui:composition template="../templates/template.xhtml">
		
			<ui:define name="title">#{bundle.venda_titulo_consultar}</ui:define>

			<ui:define name="content">
				
				<rich:panel>
					<f:facet name="header">#{bundle.venda_titulo_consultar}</f:facet>
					<a4j:form>
						<h:panelGrid columns="2">
						<h:commandButton action="#{vendaBackBean.obterListaVenda}" value="#{bundle.venda_btn_consultar}" />
						
						<a4j:commandButton value="#{bundle.venda_btn_novo}" actionListener="#{vendaBackBean.listenerIrInserirVenda}" id="btnNovo" reRender="formVendaManter">
							<rich:componentControl for="manterVenda" attachTo="btnNovo" operation="show" event="onclick" />
						</a4j:commandButton>
						</h:panelGrid>
						
						<div class="linha"/>
						
						
						<rich:dataTable value="#{vendaBackBean.vendaFormBean.listaVenda}" var="venda" id="gridVenda" rows="10" align="center" width="100%">
							<rich:column filterBy="#{venda.codigo}">
								<f:facet name="header">
									<h:outputText value="#{bundle.venda_codigo}"/>
								</f:facet>
								<h:outputText value="#{venda.codigo}"/>
							</rich:column>
							<rich:column filterBy="#{venda.clienteVO.nome}" >
								<f:facet name="header">
									<h:outputText value="#{bundle.venda_cliente_nome}"/>
								</f:facet>
								<h:outputText value="#{venda.clienteVO.nome}" />
							</rich:column>
							<rich:column filterBy="#{venda.dataCriacao}">
								<f:facet name="header">
									<h:outputText value="#{bundle.venda_data_criacao}"/>
								</f:facet>
								<h:outputText value="#{venda.dataCriacao}">
									<f:convertDateTime pattern="dd/MM/yyyy, HH:mm" timeZone="America/Sao_Paulo" />
								</h:outputText>
							</rich:column>
							<rich:column filterBy="#{venda.dataAlteracao}">
								<f:facet name="header">
									<h:outputText value="#{bundle.venda_data_alteracao}"/>
								</f:facet>
								<h:outputText value="#{venda.dataAlteracao}">
									<f:convertDateTime pattern="dd/MM/yyyy, HH:mm" timeZone="America/Sao_Paulo" />
								</h:outputText>
							</rich:column>
							<rich:column>
								<a4j:commandButton id="btnEditar" actionListener="#{vendaBackBean.listenerIrEditarVenda}" value="#{bundle.venda_btn_editar}" reRender="formVendaManter">
									<f:param id="codigoVendaEditar" name="codigoVendaEditar" value="#{venda.codigo}" />
									<rich:componentControl for="manterVenda" attachTo="btnEditar" operation="show" event="onclick" />
								</a4j:commandButton>
							</rich:column>
							<rich:column>
								<a4j:commandButton id="btnExcluir" actionListener="#{vendaBackBean.listenerIrExcluirVenda}" value="#{bundle.venda_btn_excluir}" reRender="formVendaManter">
									<f:param id="codigoVendaExcluir" name="codigoVendaExcluir" value="#{venda.codigo}" />
									<rich:componentControl for="manterVenda" attachTo="btnExcluir" operation="show" event="onclick" />
								</a4j:commandButton>
							</rich:column>
						</rich:dataTable>
						
						<rich:datascroller for="gridVenda" maxPages="10"/>
						
						<div class="linha"/>
					
					</a4j:form>
				</rich:panel>
				
				<ui:include src="/pages/venda/manterVenda.xhtml" />
				
			</ui:define>
			
		</ui:composition>
		
	</body>

</html>